package com.jiaai.web.zfp_back.member;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.member.api.IWalletAPI;
import com.jiaai.member.api.IWalletHisApi;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.*;

/**
 * class_name:ZBWalletController
 * describe:TODO
 * create_user:张昉平
 * create_date:2017/12/18
 * create_date:14:38
 */
@RestController
@RequestMapping("/api/v1/admin/wallet")
public class ZBWalletController {

    @Reference
    private IWalletAPI iWalletAPI;
    @Reference
    private IWalletHisApi iWalletHisApi;

    @GetMapping("/list")
    public Object list(@RequestParam Integer curr, String mId, String nickName){
        return RestResultGenerator.genSuccessResult(iWalletAPI.backWalletQuery(curr, mId, nickName));
    }

    @GetMapping("/his/{mId}")
    public Object hisId(@PathVariable("mId") String mId){
        return RestResultGenerator.genSuccessResult(iWalletHisApi.getOnesHist(mId));
    }

    @PostMapping("/recharge")
    public Object recharge(@RequestParam String mId, @RequestParam Integer money){
        iWalletAPI.recharge(mId, money);
        return RestResultGenerator.genSuccessResult("成功");
    }
}
